package com.flnet.spsys.controller;

import com.flnet.spsys.entity.ContractPlanner;
import com.flnet.spsys.service.ContractPlannerService;
import com.flnet.spsys.utils.ResultJson;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/contractPlanner")
public class ContractPlannerController extends BaseController{
    @Autowired
    private ContractPlannerService contractPlannerService;

    @ApiOperation(value = "策划师信息",notes = "获取策划师信息")
    @ApiResponses(
            @ApiResponse(code = 200,message = "获取成功",response = ResultJson.class)
    )
    @ResponseBody
    @CrossOrigin
    @PostMapping("/info")
    public Object getContractPlannerInfo(){
        List<ContractPlanner> contractPlannerList = contractPlannerService.list();
        return ResultJson.success(contractPlannerList);
    }
    @ResponseBody
    @PostMapping("/insert")
    @CrossOrigin
    public boolean insertContractPlanner(ContractPlanner contractPlanner){
        contractPlanner.setId(3);
        contractPlanner.setName("张三");
        contractPlanner.setIdCard("123456789123456789");
        contractPlanner.setPhone("12345678910");
        contractPlanner.setExperienceYear(10);
        contractPlanner.setIdentityPhoto(null);
        contractPlanner.setProvince("浙江");
        contractPlanner.setArea("杭州");
        contractPlanner.setGoodType(null);
        contractPlanner.setSingleRemind(null);
        boolean save = contractPlannerService.save(contractPlanner);
        return save;
    }

}
